<?php

function mn_format($input) {
	// require "class.post.php";
	$output = "";
	$output = preg_replace_callback("/\[\[([\x{0000}-\x{005A}\x{005C}\x{005E}-\x{FFFF}]+)\|([\x{0000}-\x{005A}\x{005C}\x{005E}-\x{FFFF}]+)\]\]/u", 
				create_function(
					'$matches',
					'return "<a href=\'javascript:;\' onclick=\'jump(&#34;$matches[1]&#34;)\'; ".Post::exists($matches[1]).">".htmlspecialchars($matches[2])."</a>";'
				),
				$input);
	$output = preg_replace_callback("/\[\[([\x{0000}-\x{005A}\x{005C}\x{005E}-\x{FFFF}]+)\]\]/u", 
				create_function(
					'$matches',
					'return "<a href=\'javascript:;\' onclick=\'jump(&#34;$matches[1]&#34;)\'; ".Post::exists($matches[1]).">".htmlspecialchars($matches[1])."</a>";'
				), 
				$output);
        return $output;	
}

function mn_jsonify($input) {
        $output = preg_replace("/\"/u", "&#34;", $input);
	$output = preg_replace("/\\\\/u", "&#92;", $output);
	$output = preg_replace("/\'/u", "&#39;", $output);
	return $output;
}

?>
